﻿using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;

// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");

//using (Image<Rgba32> img1 = Image.Load<Rgba32>($@"E:\James.Liu\Projects\1.jpg"))
//{
//	using (Image<Rgba32> img2 = Image.Load<Rgba32>($@"E:\James.Liu\Projects\2.jpg"))
//	{
//		int width = img1.Width;
//		int height = Math.Max(img1.Height,img2.Height);
//		using (Image<Rgba32> outputImg = new Image<Rgba32>(width,height))
//		{
//			outputImg.Mutate(x=>x.DrawImage(img1,new Point(0,0),1f));

//			outputImg.Mutate(x=>x.DrawImage(img2,new Point(img1.Width - img2.Width,0),1f));

//			outputImg.Mutate(x => x.Resize(new ResizeOptions
//			{
//				Size = new Size(800,600),
//				Mode = ResizeMode.Max
//			}));

//			outputImg.Save($@"E:\James.Liu\Projects\outputImg.jpg");
//		}
//	}
//}

using (Image img1 = Image.Load($@"E:\James.Liu\Projects\1.jpg"))
{
    using (Image img2 = Image.Load($@"E:\James.Liu\Projects\2.jpg"))
    {
        int width = img1.Width;
        int height = Math.Max(img1.Height, img2.Height);
        using (Image outputImg = new Image<Rgba64>(width, height))
        {
            outputImg.Mutate(x => x.DrawImage(img1, new Point(0, 0), 1f));

            outputImg.Mutate(x => x.DrawImage(img2, new Point(img1.Width - img2.Width, 0), 1f));

            outputImg.Mutate(x => x.Resize(new ResizeOptions
            {
                Size = new Size(width, height),
                Mode = ResizeMode.BoxPad
            }));

            outputImg.Save($@"E:\James.Liu\Projects\outputImg.jpg");
        }
    }
}